package com.gxc.datacore.metadata.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gxc.datacore.metadata.domain.DatabaseType;
import com.gxc.dbcore.dao.SqlDao;
import com.gxc.dbcore.service.BeanService;
import com.gxc.dbcore.util.PageInfo;
import com.gxc.dbcore.util.PageList;

@Service
public class DatabaseTypeService {

	@Autowired
	private SqlDao sqlDao;
	@Autowired
	private BeanService beanService;

	public DatabaseType retrieve(String id) {
		return beanService.get(sqlDao, DatabaseType.class, id);
	}

	public int create(DatabaseType databaseType) {
		return beanService.create(sqlDao, databaseType);
	}

	public int update(DatabaseType databaseType) {
		return beanService.update(sqlDao, databaseType);
	}

	public int delete(String id) {
		return beanService.delete(sqlDao, DatabaseType.class, id);
	}

	public int delete(String[] idArray) {
		return beanService.delete(sqlDao, DatabaseType.class, idArray);
	}

	@SuppressWarnings("rawtypes")
	public List list(Map parameter) {
		return sqlDao.selectList("datacore.databaseType.list", parameter);
	}

	@SuppressWarnings("rawtypes")
	public PageList listPage(Map parameter, PageInfo pageInfo) {
		return sqlDao.selectPageList("datacore.databaseType.list", parameter,
				pageInfo);
	}

}
